import { useState, useReducer } from "react";
// React.useState
const App = () => {
  const [count, setCount] = useState(0);

  return (
    <div>
      {" "}
      <button onClick={() => setCount(count + 1)}>+1</button> {count}
    </div>
  );
};

const App2 = () => {
  const reducer = (state, action) => {
    switch (action.type) {
      case "INS":
        return state + 1;
      case "DES":
        return state - 1;
      default:
        return state;
    }
  };
  const [state, dispatch] = useReducer(reducer, 0);

  return (
    <div>
      {" "}
      <button onClick={() => dispatch({ type: "INS" })}>+1</button> {state}{" "}
    </div>
  );
};


export {
    App,
    App2
}